﻿using System;
using System.Collections;
using System.Collections.Specialized;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Text;
using System.IO;
using System.Xml.Serialization;

using MVPlan.Engine;
using MVPlan.Engine.Gases;
using MVPlan.Engine.Modeling;
using MVPlan.Engine.Segment;

namespace OneStop.UI
{
    static class Extensions
    {
        public static string FormatGf(this double value)
        {
            return (value * 100).ToString("F0");
        }

        public static string FormatPPO2(this double value)
        {
            return value.ToString("F2");
        }

        public static double ToDouble(this string text)
        {
            return double.Parse(text);
        }

        public static bool IsGasEnabled(this BindingList<Gas> gases, Gas g)
        {
            foreach (Gas h in gases)
            {
                if (h.ShortName == g.ShortName)
                {
                    return h.Enable;
                }
            }

            return false;
        }

        //public static List<SegmentDive> ToList(this BindingList<SegmentDive> segments)
        //{
        //    List<SegmentDive> list = new List<SegmentDive>();

        //    foreach (SegmentDive g in segments)
        //    {
        //        list.Add(g);
        //    }

        //    return list;
        //}
    }
}
